<?php
/**
 *
 * 版权所有：恰维网络<qwadmin.qiawei.com>
 * 作    者：寒川<hanchuan@qiawei.com>
 * 日    期：2016-01-21
 * 版    本：1.0.0
 * 功能说明：前台控制器演示。
 *
 **/
namespace Home\Controller;

use Vendor\Page;

class IndexController extends ComController
{
    


    public function index()
    {
        // dump($_SESSION);
        // exit;
       if (empty($_SESSION['hid'])) {
          $this->redirect('Login/index');
          exit;
       }

       $uid = $_SESSION['hid'];
       $list = M('user')->where(['id'=>$uid])->select();

       $name = $list[0]['name'];
      
        $this->assign('name',$name);
        $this->display();
    }


   
    //办公用品分类申请
    public function fen()
    {
        $this->display();
    }
   
    //月度物资分类申请
    public function yfen()
    {
        $this->display();
    }



    //办公用品申请模版 1:办公用品/2:劳保用品/3:招待用品
    public function add()
    {

        $type = $_GET['type'];

        switch ($type) {
            case '1':  //办公用品
                $db = M("stock");
                $list = $db->where(['x_type'=>1])->select();
                $title = '办公用品申请';
                $lei = 1 ;//办公用品申请模块
                $this->assign('lei',$lei);
                $this->assign('list',$list);
                $this->assign('page',$show);
                $this->assign('title',$title);
                
                $this->display();
                
                break;
            case '2':  //劳保用品
                $db = M("stock");
                $list = $db->where(['x_type'=>2])->select();
                $title = '劳保用品申请';
                $lei = 2 ;//劳保用品申请模块
                $this->assign('lei',$lei);
                $this->assign('list',$list);
                $this->assign('page',$show);
                $this->assign('title',$title);
                
                $this->display();
                
                break;
            case '3':  //劳保用品
                $db = M("stock");
                $list = $db->where(['x_type'=>3])->select();
                $title = '招待用品申请';
                $lei = 3 ;//招待用品申请模块
                $this->assign('lei',$lei);
                $this->assign('list',$list);
                $this->assign('page',$show);
                $this->assign('title',$title);
                
                $this->display();
                
                break;
        }


        // dump(I());
        // exit;
        // $this->display();

    }






    
}